<template>
  <div>
    <!-- 标题 -->
    <div class="cardtop">
      <div class="mmk">
        <p>工单状态</p>
        <!-- <span>工单状态</span> -->
      </div>
      <div class="nji">
        <div class="block">
          <el-date-picker
            v-model="value1"
            type="daterange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
          >
          </el-date-picker>
        </div>
        <div class="nian">
          <p :class="isSelected1 ? 'is-selected' : ''" @click="addFn(1)">周</p>
          <p :class="isSelected2 ? 'is-selected' : ''" @click="addFn(2)">月</p>
          <p :class="isSelected3 ? 'is-selected' : ''" @click="addFn(3)">年</p>
        </div>
      </div>
    </div>
    <!-- 图形化 -->
    <div class="ranelse"></div>
  </div>
</template>

<script>
export default {
  name: 'aa-vv',
  data () {
    return {
      pickerOptions: {
        shortcuts: [
          {
            text: '最近一周',
            onClick (picker) {
              const end = new Date()
              const start = new Date()
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
              picker.$emit('pick', [start, end])
            }
          },
          {
            text: '最近一个月',
            onClick (picker) {
              const end = new Date()
              const start = new Date()
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
              picker.$emit('pick', [start, end])
            }
          },
          {
            text: '最近三个月',
            onClick (picker) {
              const end = new Date()
              const start = new Date()
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
              picker.$emit('pick', [start, end])
            }
          }
        ]
      },
      isSelected1: false,
      isSelected2: false,
      isSelected3: false,
      value1: '',
      value2: ''
    }
  },
  methods: {
    addFn (id) {
      // 右上切换器
      if (id === 1) {
        this.isSelected2 = false
        this.isSelected3 = false
        this.isSelected1 = !this.isSelected1
      } else if (id === 2) {
        this.isSelected1 = false
        this.isSelected3 = false
        this.isSelected2 = !this.isSelected2
      } else if (id === 3) {
        this.isSelected2 = false
        this.isSelected1 = false
        this.isSelected3 = !this.isSelected3
      }
    }
  }
}
</script>

<style lang="scss" scoped>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
.cardtop {
  position: relative;
  height: 80px;
  line-height: 80px;
  display: flex;
  justify-content: space-between;
  border-bottom: 3px groove #f8fafd;
  .mmk {
    margin-top: 20px;
    width: 100%;
    width: 640px;
    height: 30px;
    line-height: 30px;
    p {
      margin-left: 20px;
      font-size: 20px;
      font-weight: 700;
    }
  }
  .nji {
    flex: 1;
    display: flex;
    justify-content: space-between;
    .block {
      margin: 0;
    }
    .nian {
      margin-top: 20px;
      height: 40px;
      display: flex;
      align-items: center;
      border-radius: 5px;
      background-color: rgb(164, 165, 163);
      P {
        width: 60px;
        height: 40px;
        line-height: 40px;
        padding-bottom: 10px;
        text-align: center;
        margin: 10px 2px;
        border-radius: 5px;
      }
      .is-selected {
        color: #1989fa;
        background-color: rgb(182, 118, 49);
      }
    }
  }
}
.ranelse {
  position: absolute;
  left: 75%;
  top: 80%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 50vh;
  margin: 10px;
  padding-right: 20px;
  // background-color: rgb(141, 75, 75);
  background: url("https://likede2-admin.itheima.net/img/empty.87c4f71b.png")
    no-repeat;
}
</style>
